package rpc_client

import (
	"common"
	"context"
	"fmt"
	"google.golang.org/grpc"
	"protos/demo1_proto"
)

func Demo1Method() {
	fmt.Println("开始调用method1 中的方法")
	ip, port := common.GetEtcdServer("demo1")
	fmt.Println(port)
	conn, err := grpc.Dial(ip+":"+"50001", grpc.WithInsecure())
	if err != nil {
		panic(err)
	}
	client := demo1_proto.NewGreeterClient(conn)
	reply, err := client.Demo1Method(context.Background(), &demo1_proto.HelloRequest{Name: "demo1"})
	if err != nil {
		panic(err)
	}
	fmt.Println(reply.Message)

}
